import { Injectable } from '@angular/core';
import { HttpClientService } from '../../../services/http-client.service';
@Injectable()
export class RoleControlService {

	constructor(
		public httpClient: HttpClientService
	) { }
	// 角色分页列表
	getRoleList(getBody) {
		return this.httpClient.get('/pms/v1/common/role/roleListPage', getBody);
	}
	/**
	 * 新增角色数据
	 */
	addRole(postBody) {
		return this.httpClient.post('/pms/v1/common/role/role', postBody);
	}
	/**
	     * 编辑角色数据
	     */
	editRole(editBody) {
		return this.httpClient.put('/pms/v1/common/role/role', editBody);
	}
	/**
	 * 删除单个角色数据
	 * @param nRoleid 
	 */
	delRoled(nRoleid) {
		return this.httpClient.put('/pms/v1/common/role/roleDel/' + nRoleid);
	}
	//组织树
	getDeptTree(roleId) {
		return this.httpClient.get('/pms/v1/common/dept/deptTree'+'?nRoleid='+roleId);
	}
	//菜单权限树
	getMenuTree(getBody) {
		return this.httpClient.get('/pms/v1/common/MenuResource/RoleMenuTree/'+getBody);
	}
	//获取部门下所有员工
	getDeptStaffs(getBody){
		return this.httpClient.get('/pms/v1/common/dept/deptStaffs/'+getBody);
	}
	//查询-角色数据权限标签
	getDataAuthority(getBody){
		return this.httpClient.get('/pms/v1/common/role/fundTypeLabel/'+getBody);
	}
	//查询-角色文档权限
	getDocumentAuthority(getBody){
        return this.httpClient.get('/pms/v1/common/attachConf/attachConfLabelBean/'+getBody);
	}
	//添加-角色用户
	addRoleUser(postBody){
		return this.httpClient.post('/pms/v1/common/role/roleUserMore', postBody);
	}
	//查询该角色下所有用户信息
	getRoleUserList(getBody){
		return this.httpClient.get('/pms/v1/common/role/listUserByRoleid/'+getBody);
	}
	//查询-角色菜单资源权限标签
	getMenuResLabel(getBody){
		return this.httpClient.get('/pms/v1/common/MenuResource/menuResLabel/'+getBody.nRoleid+'?sMenuCode='+getBody.sMenuCode);
	}
	//删除-角色用户(单个)
	delRoleUser(putBody){
		return this.httpClient.put('/pms/v1/common/role/roleUserDel/' + putBody.nRoleid+'?sUsername='+putBody.sUsername);
	}
	//更新-角色菜单权限
	updateMenuAuthority(postBody,nRoleid){
		return this.httpClient.post('/pms/v1/common/role/roleMenu/'+nRoleid, postBody);
	}
	//更新-角色数据权限
	updateInfoAuthority(putBody){
        return this.httpClient.put('/pms/v1/common/role/roleData', putBody);
	}
	//查询-用户的产品代码列表（分页）
	getListRoleDataFundCodePage(getBody){
		return this.httpClient.get('/pms/v1/common/role/listRoleDataFundCodePage'+'?pageIndex='+getBody.pageIndex+'&pageSize='+getBody.pageSize);
	}
	//查询-所有部门信息
	getAlldept(){
		return this.httpClient.get('/pms/v1/common/dept/allDept');
	}
}
